<?php
/* @var $model \common\models\c2\entity\FeUserProfile */

use kartik\builder\Form;
use kartik\widgets\ActiveForm;
use kzo\base\widgets\ui\bs4\Alert;
use yii\helpers\Html;
use yii\widgets\Pjax;

$regularLangName = \Yii::$app->kzoHelper->getRegularLangName();
$messageName = $model->getMessageName();
?>

<?php
Pjax::begin(['id' => $model->getDetailPjaxName(), 'formSelector' => $model->getBaseFormName(true), 'enablePushState' => false, 'clientOptions' => [
    'skipOuterContainers' => true
]]);

?>

<?php
$form = ActiveForm::begin([
    'action' => ['edit-profile', 'id' => $model->id],
    'options' => [
        'id' => $model->getBaseFormName(),
        'data-pjax' => true,
    ]]);
?>

    <div class="<?= $model->getPrefixName('form') ?>
">
        <?php if (Yii::$app->session->hasFlash($messageName)): ?>
            <?php if (!$model->hasErrors()) {
                echo Alert::widget([
                    'type' => Alert::TYPE_SUCCESS,
                    'title' => 'Well Down',
                    'icon' => 'fas fa-ok-circle',
                    'body' => Yii::$app->session->getFlash($messageName),
                    'showSeparator' => true,
                    'delay' => 2000
                ]);
            } else {
                echo Alert::widget([
                    'type' => Alert::TYPE_WARNING,
                    'title' => 'Warning!',
                    'icon' => 'fas fa-ok-circle',
                    'body' => Yii::$app->session->getFlash($messageName),
                    'showSeparator' => true,
                ]);
            }
            ?>
        <?php endif; ?>

        <div class="well">
            <?php
            echo Form::widget([
                'model' => $model,
                'form' => $form,
                'columns' => 2,
                'attributes' => [
                    'address' => [
                        'type' => Form::INPUT_TEXT,
                        'options' => [
                            'placeholder' => $model->getAttributeLabel('address')
                        ]
                    ],
                    'user_id' => [
                        'type' => Form::INPUT_HIDDEN, 'options' => [
                            'placeholder' => $model->getAttributeLabel('user_id'),
                            'readonly' => true,
                            'value' => $model->id,
                        ]
                    ],
                ]
            ]);
            echo Html::submitButton('<i class="fa fa-save"></i> ' . Yii::t('app.c2', 'Save'), ['type' => 'button', 'class' => 'btn btn-primary float-right ml-2']);
            // echo Html::a('<i class="fa fa-arrow-left"></i> ' . Yii::t('app.c2', 'Go Back'), ['index'], ['data-pjax' => '0', 'class' => 'btn btn-default pull-right', 'title' => Yii::t('app.c2', 'Go Back'),]);
            ?>
        </div>
    </div>
<?php ActiveForm::end(); ?>

<div style="clear: both;"></div>


<?php
Pjax::end();

?>